<?php
/**
 * 
 */
require_once 'Zend/Sql/Adapter/Standard/Clause/Abstract.php';
require_once 'Zend/Sql/Adapter/Standard/Expression/Identifier/Table.php';
require_once 'Zend/Sql/Adapter/Standard/Statement/Abstract.php';

/**
 * 
 * @author MARIA
 *
 */
class Zend_Sql_Adapter_Standard_Clause_From
	extends Zend_Sql_Adapter_Standard_Clause_Abstract
{
	/**
	 * 
	 * @var Zend_Sql_Adapter_Standard_Expression_Identifier_Table|Zend_Sql_Adapter_Standard_Statement
	 */
	protected $identifier;
	
	/**
	 * @return the $identifier
	 */
	public function getIdentifier() {
		return $this->identifier;
	}

	/**
	 * @param Zend_Sql_Adapter_Standard_Expression_Identifier_Table|Zend_Sql_Adapter_Standard_Statement $identifier
	 */
	public function setIdentifier($identifier) {
		$this->identifier = $identifier;
	}

	public function __construct($identifier=null) {
		if ( ! $identifier instanceof Zend_Sql_Adapter_Standard_Expression_Identifier_Table &&
			 ! $identifier instanceof Zend_Sql_Adapter_Standard_Statement_Abstract
			) {
			require_once 'Zend/Sql/Exception.php';
			throw new Zend_Sql_Exception('Invalide type');
		}
		if ($identifier) {
			$this->setIdentifier($identifier);
		}
	}
	
	public function toString() {
		return 'FROM ' . $this->identifier->toString();
	}
}
